﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CreateUser.aspx.cs" Inherits="CreateUser" %>

<asp:Content ID="contentCreateUser" ContentPlaceHolderID="BodyContent" runat="Server">
    <div class="contentfull">
        <div class="breadcrumbs">
            <ul id="crumbs">
                <li><a title="My Account" href="/account/">My Account</a>
                    <img src="Content/Images/separator.png" alt="&rarr;" class="separator">
                    Staffs 			</li>
            </ul>
        </div>

        <div id="showMessages" runat="server" visible="false">
            <div class="warning">
                <p></p>
                <li>
                    <span id="spMsg" runat="server"></span>

                </li>
                <p></p>
            </div>

        </div>


        <div class="top">
            <h1>Add a Staff</h1>
        </div>

        <div class="content">
            <fieldset>
                <legend></legend>
                <form method="POST" action="UserCreated.aspx">
                    <input type="hidden" name="action" value="UserCreated.aspx" />
                    <input type="hidden" name="userId" value="<% =UserId %>" />
                    <label for="username" class="large">Username</label>
                    <input type="text" class="largeinput" name="username" id="username" value="<% =UserName%>" /><br />
                    <br />

                    <label for="password" class="large">Password </label>
                    <span class="lower_comment same">SSICA users' passwords unencrypted by default. This allows you to easily remind passwords to your users. If you feel this is not right for your account, you can enable secure password encryption at any time in your <a href="javascript:alert('under construction');">Account Settings</a>.        </span>
                    <input type="text" class="largeinput" id="password" name="password" autocomplete="off" value="<% =Password %>" />

                    <label class="large">Authorized to Scan For...</label>

                    <span class="label" id="header1">Filter Buttons: </span>
                    <div style="clear: both;"></div>
                    <br>

                    <div id="checkbox_list2" class="indent1" style="display: block">
                        <input type="checkbox" id="select_all">
                        <label for="select_all">Select ALL</label>
                        <br />
                        <div class="wrapper">                          
                              <ul id="user_checkbox_list">
                                  <%= LoadServiceList() %>
                              
                            </ul> 
                        </div>
                    </div>

                    <script>

                        $(document).ready(function () {
                            function listFilter(header1, list) {
                                input = $("<input>").attr({ "id": "filtertext", "class": "filterinput inputnormalwide", "type": "text", "placeholder": "Type to begin filtering..." }),
                                clear = $("<span>").text("clear").attr({ "id": "clear_filter" });

                                $(clear).insertAfter(header1);
                                $(input).insertAfter(header1);

                                $(clear).hide();

                                $(input).change(function () {

                                    if ($(input).val().length > 0) {
                                        $(clear).show();
                                    }
                                    else {
                                        $(clear).hide();
                                    }

                                    var filter = $(this).val().toLowerCase();
                                    if (filter) {
                                        $(list).find("label").each(function () {
                                            if ($(this).text().toLowerCase().indexOf(filter) === -1) {
                                                $(this).parent().slideUp();
                                            } else if ($(this).text().toLowerCase().indexOf(filter) !== -1) {
                                                $(this).parent().slideDown();
                                            }
                                        });
                                    } else {
                                        $(list).find("label:not(:empty)").parent().slideDown();
                                        $("#select_all").attr('checked', false);
                                    }
                                    return false;
                                })
                                .keyup(function () {
                                    $(this).change();
                                });
                            }


                            listFilter($("#header1"), $("#user_checkbox_list"));
                            $("#clear_filter").click(function (event) {
                                $('#filtertext').val('');
                                $('#filtertext').change();
                            });

                        });


                        $("#select_all").live("change", function (event) {
                            $($('input:[id^="inputee"]').filter(':visible')).attr('checked', $(this).is(':checked')).next().css('font-weight', $(this).is(':checked') ? 'bold' : 'normal');
                        });

                        $("#select_all").attr('checked', false);

                        $('input:[id^="inputee"]').live("change", function (event) {
                            var unchecked_present = true;
                            $('input:[id^="inputee"]').each(function (i) {
                                if (!$(this).is(':checked')) {
                                    unchecked_present = false;
                                }
                            });
                            $("#select_all").attr('checked', unchecked_present);
                            $(this).next().css('font-weight', $(this).is(':checked') ? 'bold' : 'normal');
                        });


                    </script>

                    <label class="large">Advanced</label>
                    <div id="showDeviceLimitFieldDiv" class="divradioset">
                        <input type="checkbox" id="showDeviceLimitField" name="activateDeviceLimit" <% =DeviceCountCheck %> class="showradio" />
                        <label for="showDeviceLimitField">Set Device Limit</label>
                        <span class="lower_comment">This setting keeps your user from activating an unlimited number of devices.</span>
                        <div class="showdiv">
                            Limit the user up to
                            <input type="text" class="inputed_number" name="deviceLimit" id="deviceLimit" maxlength="4" value="<% =DeviceCount %>" />
                            devices.
                        </div>
                    </div>
                    <script>
                        $(document).ready(function () {
                            activateDivRadioSet("#showDeviceLimitFieldDiv");
                            var all_inputs = $('input:[id^="inputee"]');
                            $("#select_all").change(function (event) {
                                all_inputs.attr('checked', $(this).is(':checked')).next().css('font-weight', $(this).is(':checked') ? 'bold' : 'normal');
                            });

                            all_inputs.change(function (event) {
                                var unchecked_present = true;
                                all_inputs.each(function (i) {
                                    if (!$(this).is(':checked')) {
                                        unchecked_present = false;
                                    }
                                });
                                $("#select_all").attr('checked', unchecked_present);
                                $(this).next().css('font-weight', $(this).is(':checked') ? 'bold' : 'normal');
                            });

                        });
                    </script>
                    <br />
                    <input type="submit" value="<% =ButtonName %>" class="black_button blarge" />
                </form>
            </fieldset>

        </div>

    </div>
    <!-- /.contentfull -->
</asp:Content>

